import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        String[] name = new String[]{"A","B","C","D","E"};
        Scanner sc = new Scanner(System.in);
        int[] grade = new int[5];

        for (int i = 0; i < grade.length; i++) {
            grade[i] = sc.nextInt();
        }

        for (int i = 0; i < grade.length - 1; i++) {
            for (int j = 0; j < grade.length - 1 - i; j++) {
                if (grade[j] < grade[j + 1]) {
                    int temp = grade[j];
                    String t = name[j];
                    grade[j] = grade[j + 1];
                    name[j] = name[j+1];
                    grade[j + 1] = temp;
                    name[j+1] = t;
                }
            }
        }

        for (int i = 0; i < name.length; i++) {
            System.out.println(name[i]);
        }

    }
}